package hr.dario.fragments;

import android.support.v4.app.FragmentActivity;
import android.support.v4.view.MenuItem;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;

public class LocDescActivity extends FragmentActivity{
	
	
    /** Called when the activity is first created. */
    	
    	private static final int NAVIGATE_UP = 100;
    	
    	@Override
		public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
	            finish();
	            return;
	        }

	        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	        //getSupportActionBar().setDisplayShowHomeEnabled(false);
	        //getSupportActionBar().setDisplayShowTitleEnabled(false);
	        getSupportActionBar().setTitle(getResources().getString(R.string.naslovna_btn_zujanje_okolo));
	        
	       
	        
	        if (savedInstanceState == null) {
                // During initial setup, plug in the details fragment.
                LocDescFragment details = new LocDescFragment();
                details.setArguments(getIntent().getExtras());
                getSupportFragmentManager().beginTransaction().add(
                        android.R.id.content, details).commit();
            }
						
	    }
    	/*
    	@Override
   	 	public boolean onCreateOptionsMenu(Menu menu) {
    		 getMenuInflater().inflate(R.menu.loc_desc_actionbar, menu);
    		
    		 /*
	    	 menu.add(0, NAVIGATE_UP, 0, R.string.naslovna_btn_zujanje_okolo)
			    .setIcon(R.drawable.ic_title_share_default)
			    .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    		 */
    	/*	 
	    	 return super.onCreateOptionsMenu(menu);
   	 	}
    	*/
    	@Override
    	public boolean onOptionsItemSelected(MenuItem item) {
    	 
    		switch (item.getItemId()) {
    		 
    		case android.R.id.home:
    			// app icon in action bar clicked; go home
    		 	Intent intent = new Intent(this, ActionBarTabsPager.class);
    		 	intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    		 	startActivity(intent);
    		 	return true;
    		 default:
    		 	return super.onOptionsItemSelected(item);
    	     }       
    	 }
    	 
    
    
}